package god530.com.simpleapp_slide.account.tabs.account.presenter;

import god530.com.simpleapp_slide.account.title.db.AccountTypeDBHelper;
import god530.com.simpleapp_slide.account.tabs.account.model.AccountModel;
import god530.com.simpleapp_slide.account.tabs.account.view.IAccountDetailsView;
import god530.com.simpleapp_slide.account.utils.MyLog;

/**
 * Created by root on 16-2-1.
 */
public class AccountDetailsPresenter {

    IAccountDetailsView iAccountDetailsView;

    public AccountDetailsPresenter(IAccountDetailsView iAccountDetailsView) {
        this.iAccountDetailsView = iAccountDetailsView;
    }

    public void saveAccountItem(AccountModel accountModel) {
        MyLog.i("saveAccouhtItem:"+accountModel);
        AccountTypeDBHelper.getInstance(iAccountDetailsView.getContext()).insert(accountModel);
    }

    public void deleteAccountItem(AccountModel accountModel){
        AccountTypeDBHelper.getInstance(iAccountDetailsView.getContext()).delete(accountModel);
    }

    public void updateAccountItem(AccountModel accountModel) {
        AccountTypeDBHelper.getInstance(iAccountDetailsView.getContext()).update(accountModel);
    }

}
